package chapter_7;

import java.io.File;

public class Test4 {

    public static void main(String[] args) {
        printFile(new File("D:\\Project\\kecheng\\Cy16"));
    }

    public static void printFile(File file){
        if(file.isFile()){
            System.out.println(file.getName());
        }else if(file.isDirectory()){
            System.out.println("--"+ file.getName());
            File[] files = file.listFiles();
            for (File file1 : files) {
                printFile(file1);
            }
        }
    }
}
